package com.qijian.production.domain.query;

import com.baomidou.mybatisplus.annotation.TableName;
import com.qijian.common.utils.mybatis.WhereType;
import com.qijian.common.utils.mybatis.WhereTypeEnum;
import lombok.Data;
import lombok.ToString;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * 非标准定额申请单对象 查询条件类
 *
 * @author qijian
 * @date 2023-12-06
 */
@Data
@ToString
@TableName("main_point_order")
public class PointOrderQuery {

    @WhereType(filed = "id")
    private Long id;
    @WhereType(filed = "id", type = WhereTypeEnum.IN)
    private Set<Long> ids;
    @WhereType(filed = "apply_id")
    private Long applyId;
    @WhereType(filed = "apply_name")
    private String applyName;
    @WhereType(filed = "apply_dept_id")
    private Long applyDeptId;
    @WhereType(filed = "apply_dept_name", type = WhereTypeEnum.LIKE)
    private String applyDeptName;
    @WhereType(filed = "apply_date",type = WhereTypeEnum.BETWEEN)
    private Date[] applyDate;
    @WhereType(filed = "number")
    private String number;
    @WhereType(filed = "dispatch_attr")
    private String dispatchAttr;
    @WhereType(filed = "remark")
    private String remark;

    @WhereType(ignore= true)
    private List<String> approvalStatus;

    @WhereType(func = "EXISTS (select 1 from t_flowable_record f  where main_point_order.id = f.source_id and f.business_key= 'point' and f.user_id ={1})")
    private Long u;


    @WhereType(func = "EXISTS (select 1 from t_flowable_record f left join ACT_RU_TASK ru on ru.PROC_INST_ID_=f.process_instance_id inner join ACT_HI_IDENTITYLINK i on i.TASK_ID_=ru.ID_  where main_point_order.id = f.source_id and f.business_key= 'point'  and ( ru.ASSIGNEE_ ={1} or i.USER_ID_ = {1} ))")
    private Long i;


    @WhereType(filed = "approval_status" ,type = WhereTypeEnum.IN)
    private List<String> approve;

    @WhereType(deptTableName = "sys_user", userTableName = "sys_user")
    private Boolean dataScope;

}
